package com.byb.server.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;

/**
 * 保险产品
 */
@ApiModel(description = "保险产品")
@Entity
@Table(name = "product")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "product")
public class Product implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 产品名称
     */
    @ApiModelProperty(value = "产品名称")
    @Column(name = "product_name")
    private String productName;

    /**
     * 产品图片
     */
    @ApiModelProperty(value = "产品图片")
    @Column(name = "product_img")
    private String productImg;

    /**
     * 综合评分
     */
    @ApiModelProperty(value = "综合评分")
    @Column(name = "overall_score")
    private String overallScore;

    /**
     * 赔偿金额得分
     */
    @ApiModelProperty(value = "赔偿金额得分")
    @Column(name = "amount_of_indemnification_socre")
    private String amountOfIndemnificationSocre;

    /**
     * 保障范围得分
     */
    @ApiModelProperty(value = "保障范围得分")
    @Column(name = "ensure_scope_socre")
    private String ensureScopeSocre;

    /**
     * 如是理赔得分
     */
    @ApiModelProperty(value = "如是理赔得分")
    @Column(name = "claims_settlement_socre")
    private String claimsSettlementSocre;

    /**
     * 服务便捷得分
     */
    @ApiModelProperty(value = "服务便捷得分")
    @Column(name = "convenient_servicet_socre")
    private String convenientServicetSocre;

    /**
     * 重疾赔付次数
     */
    @ApiModelProperty(value = "重疾赔付次数")
    @Column(name = "strichen_claim_times")
    private String strichenClaimTimes;

    /**
     * 轻症赔付次数
     */
    @ApiModelProperty(value = "轻症赔付次数")
    @Column(name = "mild_claim_times")
    private String mildClaimTimes;

    /**
     * 重疾数量
     */
    @ApiModelProperty(value = "重疾数量")
    @Column(name = "strichen_num")
    private String strichenNum;

    /**
     * 轻症数量
     */
    @ApiModelProperty(value = "轻症数量")
    @Column(name = "mild_num")
    private String mildNum;

    /**
     * 重疾赔付率
     */
    @ApiModelProperty(value = "重疾赔付率")
    @Column(name = "striche_probability")
    private String stricheProbability;

    /**
     * 轻症赔付率
     */
    @ApiModelProperty(value = "轻症赔付率")
    @Column(name = "mild_probability")
    private String mildProbability;

    /**
     * 身故赔偿率
     */
    @ApiModelProperty(value = "身故赔偿率")
    @Column(name = "dc_rate")
    private String dcRate;

    /**
     * 专家评论总分
     */
    @ApiModelProperty(value = "专家评论总分")
    @Column(name = "expert_overall_score")
    private String expertOverallScore;

    /**
     * 购买链接
     */
    @ApiModelProperty(value = "购买链接")
    @Column(name = "purchase_link")
    private String purchaseLink;

    @ManyToOne
    private Isurer insurer;

    @ManyToOne
    private TypesOfInsurance typesOfInsurance;

    @ManyToMany
    @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
    @JoinTable(name = "product_word_key",
               joinColumns = @JoinColumn(name="products_id", referencedColumnName="id"),
               inverseJoinColumns = @JoinColumn(name="word_keys_id", referencedColumnName="id"))
    private Set<WordKey> wordKeys = new HashSet<>();

    // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProductName() {
        return productName;
    }

    public Product productName(String productName) {
        this.productName = productName;
        return this;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getProductImg() {
        return productImg;
    }

    public Product productImg(String productImg) {
        this.productImg = productImg;
        return this;
    }

    public void setProductImg(String productImg) {
        this.productImg = productImg;
    }

    public String getOverallScore() {
        return overallScore;
    }

    public Product overallScore(String overallScore) {
        this.overallScore = overallScore;
        return this;
    }

    public void setOverallScore(String overallScore) {
        this.overallScore = overallScore;
    }

    public String getAmountOfIndemnificationSocre() {
        return amountOfIndemnificationSocre;
    }

    public Product amountOfIndemnificationSocre(String amountOfIndemnificationSocre) {
        this.amountOfIndemnificationSocre = amountOfIndemnificationSocre;
        return this;
    }

    public void setAmountOfIndemnificationSocre(String amountOfIndemnificationSocre) {
        this.amountOfIndemnificationSocre = amountOfIndemnificationSocre;
    }

    public String getEnsureScopeSocre() {
        return ensureScopeSocre;
    }

    public Product ensureScopeSocre(String ensureScopeSocre) {
        this.ensureScopeSocre = ensureScopeSocre;
        return this;
    }

    public void setEnsureScopeSocre(String ensureScopeSocre) {
        this.ensureScopeSocre = ensureScopeSocre;
    }

    public String getClaimsSettlementSocre() {
        return claimsSettlementSocre;
    }

    public Product claimsSettlementSocre(String claimsSettlementSocre) {
        this.claimsSettlementSocre = claimsSettlementSocre;
        return this;
    }

    public void setClaimsSettlementSocre(String claimsSettlementSocre) {
        this.claimsSettlementSocre = claimsSettlementSocre;
    }

    public String getConvenientServicetSocre() {
        return convenientServicetSocre;
    }

    public Product convenientServicetSocre(String convenientServicetSocre) {
        this.convenientServicetSocre = convenientServicetSocre;
        return this;
    }

    public void setConvenientServicetSocre(String convenientServicetSocre) {
        this.convenientServicetSocre = convenientServicetSocre;
    }

    public String getStrichenClaimTimes() {
        return strichenClaimTimes;
    }

    public Product strichenClaimTimes(String strichenClaimTimes) {
        this.strichenClaimTimes = strichenClaimTimes;
        return this;
    }

    public void setStrichenClaimTimes(String strichenClaimTimes) {
        this.strichenClaimTimes = strichenClaimTimes;
    }

    public String getMildClaimTimes() {
        return mildClaimTimes;
    }

    public Product mildClaimTimes(String mildClaimTimes) {
        this.mildClaimTimes = mildClaimTimes;
        return this;
    }

    public void setMildClaimTimes(String mildClaimTimes) {
        this.mildClaimTimes = mildClaimTimes;
    }

    public String getStrichenNum() {
        return strichenNum;
    }

    public Product strichenNum(String strichenNum) {
        this.strichenNum = strichenNum;
        return this;
    }

    public void setStrichenNum(String strichenNum) {
        this.strichenNum = strichenNum;
    }

    public String getMildNum() {
        return mildNum;
    }

    public Product mildNum(String mildNum) {
        this.mildNum = mildNum;
        return this;
    }

    public void setMildNum(String mildNum) {
        this.mildNum = mildNum;
    }

    public String getStricheProbability() {
        return stricheProbability;
    }

    public Product stricheProbability(String stricheProbability) {
        this.stricheProbability = stricheProbability;
        return this;
    }

    public void setStricheProbability(String stricheProbability) {
        this.stricheProbability = stricheProbability;
    }

    public String getMildProbability() {
        return mildProbability;
    }

    public Product mildProbability(String mildProbability) {
        this.mildProbability = mildProbability;
        return this;
    }

    public void setMildProbability(String mildProbability) {
        this.mildProbability = mildProbability;
    }

    public String getDcRate() {
        return dcRate;
    }

    public Product dcRate(String dcRate) {
        this.dcRate = dcRate;
        return this;
    }

    public void setDcRate(String dcRate) {
        this.dcRate = dcRate;
    }

    public String getExpertOverallScore() {
        return expertOverallScore;
    }

    public Product expertOverallScore(String expertOverallScore) {
        this.expertOverallScore = expertOverallScore;
        return this;
    }

    public void setExpertOverallScore(String expertOverallScore) {
        this.expertOverallScore = expertOverallScore;
    }

    public String getPurchaseLink() {
        return purchaseLink;
    }

    public Product purchaseLink(String purchaseLink) {
        this.purchaseLink = purchaseLink;
        return this;
    }

    public void setPurchaseLink(String purchaseLink) {
        this.purchaseLink = purchaseLink;
    }

    public Isurer getInsurer() {
        return insurer;
    }

    public Product insurer(Isurer isurer) {
        this.insurer = isurer;
        return this;
    }

    public void setInsurer(Isurer isurer) {
        this.insurer = isurer;
    }

    public TypesOfInsurance getTypesOfInsurance() {
        return typesOfInsurance;
    }

    public Product typesOfInsurance(TypesOfInsurance typesOfInsurance) {
        this.typesOfInsurance = typesOfInsurance;
        return this;
    }

    public void setTypesOfInsurance(TypesOfInsurance typesOfInsurance) {
        this.typesOfInsurance = typesOfInsurance;
    }

    public Set<WordKey> getWordKeys() {
        return wordKeys;
    }

    public Product wordKeys(Set<WordKey> wordKeys) {
        this.wordKeys = wordKeys;
        return this;
    }

    public Product addWordKey(WordKey wordKey) {
        this.wordKeys.add(wordKey);
        wordKey.getProducts().add(this);
        return this;
    }

    public Product removeWordKey(WordKey wordKey) {
        this.wordKeys.remove(wordKey);
        wordKey.getProducts().remove(this);
        return this;
    }

    public void setWordKeys(Set<WordKey> wordKeys) {
        this.wordKeys = wordKeys;
    }
    // jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Product product = (Product) o;
        if (product.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), product.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "Product{" +
            "id=" + getId() +
            ", productName='" + getProductName() + "'" +
            ", productImg='" + getProductImg() + "'" +
            ", overallScore='" + getOverallScore() + "'" +
            ", amountOfIndemnificationSocre='" + getAmountOfIndemnificationSocre() + "'" +
            ", ensureScopeSocre='" + getEnsureScopeSocre() + "'" +
            ", claimsSettlementSocre='" + getClaimsSettlementSocre() + "'" +
            ", convenientServicetSocre='" + getConvenientServicetSocre() + "'" +
            ", strichenClaimTimes='" + getStrichenClaimTimes() + "'" +
            ", mildClaimTimes='" + getMildClaimTimes() + "'" +
            ", strichenNum='" + getStrichenNum() + "'" +
            ", mildNum='" + getMildNum() + "'" +
            ", stricheProbability='" + getStricheProbability() + "'" +
            ", mildProbability='" + getMildProbability() + "'" +
            ", dcRate='" + getDcRate() + "'" +
            ", expertOverallScore='" + getExpertOverallScore() + "'" +
            ", purchaseLink='" + getPurchaseLink() + "'" +
            "}";
    }
}
